class Solution {
public:
    vector<int> countBits(int n) 
    {
       vector<int> ret; 
        for (int i=0;i<=n;i++)
        {
            //int 32bit
            int tmp=0;
            for (int j=0;j<32;j++)
            {
                tmp+=(i>>j)&1;
            }
            ret.push_back(tmp);
        }
        return ret;
    }
};
